<style>
    #add {
        padding: 20px 25px 25px 0;
    }

    #add .layui-treeSelect .ztree li a, .ztree li span {
        margin: 0 0 2px 3px !important;
    }
</style>
<div class="layui-fluid" id="add">
    <form class="layui-form" action="" lay-filter="user-add-form">
        <div class="layui-form-item">
            <label class="layui-form-label febs-form-item-require">实验名称</label>
            <div class="layui-input-block">
                <input type="text" name="projectName" lay-verify="required" class="layui-input" readonly>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">所属实验课程</label>
            <div class="layui-input-block">
                <input type="text" name="experimentName"  id="experiment_table" class="layui-input" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label febs-form-item-require">实验描述</label>
            <div class="layui-input-block">
                <input type="text" name="projectContent" lay-verify="required" class="layui-input" readonly>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label febs-form-item-require">状态：</label>
            <div class="layui-input-block">
                <input type="radio" name="state" value="1" title="有效" checked="" disabled>
                <input type="radio" name="state" value="0" title="禁用" disabled>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" th:src="@{febs/lay/extends/wangEditor.min.js}"></script>
<script data-th-inline="javascript">

    layui.use(['febs', 'form', 'tableSelect', 'validate'], function () {
        var $ = layui.$,
            febs = layui.febs,
            layer = layui.layer,
            form = layui.form,
            project = [[${project}]],
            $view = $('#add'),
            tableSelect = layui.tableSelect,
            validate = layui.validate;

        form.verify(validate);
        form.render();

        var E = window.wangEditor;
        var editor = new E('#editor');
        // 或者 var editor = new E( document.getElementById('editor') )
        editor.create();

       /* tableSelect.render({
            elem: '#experiment_table',	//定义输入框input对象 必填
            checkedKey: 'courseName', //表格的唯一建值，非常重要，影响到选中状态 必填
            searchKey: 'courseName',	//搜索输入框的name值 默认keyword
            searchPlaceholder: '请输入实验课程',	//搜索输入框的提示文字 默认关键词搜索
            table: {	//定义表格参数，与LAYUI的TABLE模块一致，只是无需再定义表格elem
                url: ctx + 'course/select/course',
                cols: [
                    [
                        {type: 'radio'},
                        {field: 'courseName', title: '课程名称', minWidth: 100},
                        {field: 'deptNameList', title: '班级名称列表', align: 'center', width: 300},
                    ]
                ]
            },

            done: function (elem, data) {
                //选择完后的回调，包含2个返回值 elem:返回之前input对象；data:表格返回的选中的数据 []
                //拿到data[]后 就按照业务需求做想做的事情啦~比如加个隐藏域放ID...
                var NEWJSON = [];
                layui.each(data.data, function (index, item) {
                    NEWJSON.push(item.courseName);
                    $("#experimentId").val(item.courseId);
                });
                elem.val(NEWJSON.join(","))
            }

        });*/
        initUserValue();
        function initUserValue() {
            form.val("user-add-form", {
                "projectName": project.projectName,
                "projectContent": project.projectContent,
                "state": project.state,
                "experimentName": project.experimentName,
            });
        }
    })

</script>